<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>在数组的第2位置添加一个元素</title>
	</head>

	<body>

		<p id="demo">点击按钮向数组添加元素。</p>
		<button onclick="myFunction()">点我<tton>
		<script>
			function myFunction() {
				var fruits = ["Banana", "Orange", "Apple", "Mango"];
				fruits.splice(2, 0, "Strawberry");
				var x = document.getElementById("demo");
				x.innerHTML = fruits;
			}
		</script>

	</body>

<ml>
